home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000135_icon-group-sender _Wed Jun 11 11:16:51 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 11 Jun 1997 12:25:58 MST
Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
id AA08982; Wed, 11 Jun 1997 12:25:57 -0700
Date: Wed, 11 Jun 1997 11:16:51 -0700
From: swampler@noao.edu (Steve Wampler)
Subject: Re: searching with variables
To: icon-group@cs.arizona.edu
Message-Id: <swampler-9705111816.AA004014681@orpheus.gemini.edu>
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1132
- Forwarded message from espie@felouque.ens.fr on 11 Jun 1997 16:17:05 GMT -
>
> In general, icon pattern matching is not too great at stupid regular
> expression emulation. They're much better at building intricate mechanisms
> that wouldn't work with regular expression.
Well, it certainly isn't as concise as RE's, but the following matching procedure
isn't too horrible, I think:
procedure Vl(l)
static V
initial V := 'aeiou'
suspend ( tab(upto(V)), move(1)||tab(any(l)) )
end
And, if you wanted to parameterize it a bit more:
# match pairs of a letter in a followed by a letter in b
procedure pair(a,b)
suspend ( tab(upto(a)), move(1)||tab(any(b)) )
end
Both upto() and any() are efficient functions when given csets...
Here's a test driver for the second version:
procedure main()
every line := !&input do {
line ? every write( pair('aeiou', 'l') )
}
end
--
Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
O Sibile, si ergo, fortibus es inero.
Nobile, demis trux. Demis phulla causan dux.